#include<iostream>
using namespace std;
bool res(int num)
{
	int flag = 0;
	for (int i = 1;i <= num;i++)
	{
		if (num % i == 0)
		{
			flag += i;
		}
	}
	if (flag == num)
	{
		return true;
	}
	return false;
}
int countif(int start, int end, bool (*condition)(int))
{
	int sum = 0;
	for (int i = start;i <= end;i++)
	{
		if (condition(i))
		{
			sum++;
		}
	}
	return sum;
}
int main()
{
	int n1, n2;
	cin >> n1 >> n2;
	int sum = countif(n1, n2, res);
	cout << sum;
	return 0;

}